<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <style>
      h3 {
        background-color: deepskyblue;
        color: orange;
        border: 30px solid pink;
      }
    </style>
    <title>Document</title>
  </head>
  <body>
    <h3>小B-添加结构</h3>
    <script>
      document.querySelector('h3').onclick = function () {
        console.log('么么哒!')
      }
      document.querySelector('h2').onclick = function () {
        alert('大家好!')
      }
    </script>
  </body>
</html>
